import os
import shutil

f = open("dir.csv", "w")


def get_file_path(source_path, target_path):
    file_list = []
    for root, dirs, files in os.walk(source_path):
        for file in files:
            f.writelines(os.path.join(root, file) + "\n")
            file_list.append(os.path.join(root, file))
            shutil.copy(os.path.join(root, file), target_path)

    return file_list


source = input("请输入源目录:")
target = input("请输入目标目录:")
final = get_file_path(source, target)
for i in final:
    print(i)
